using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class ItemManager {
	
	static string typeName = "InventoryItem";
	
	static GenericManager<InventoryItem> _m;
	static GenericManager<InventoryItem> m
	{
		get
		{
			if(_m == null)
				_m = new GenericManager<InventoryItem>(typeName);
			return _m;
		}
	}
	
	public static Dictionary<string,string> index
	{
		get
		{
			return m.index;
		}
	}
	
	public static InventoryItem Load(string name)
	{
		return m.LoadObject(name);
	}
	
	public static bool isCustom(string name)
	{
		return m.isCustom(name);
	}
		
	public static InventoryItem AddItem(string name, string description, float weight, List<BuffDebuff> buffs, 
		float worth = 0, string slot = "None", int quantity = 1, bool hasCharges = false, int chargesRemaining = 50)
	{
		InventoryItem a = new InventoryItem();
		a.name = name;
		a.description = description;
		a.weight = weight;
		a.buffs = buffs;
		a.worth = worth;
		a.slot = slot;
		a.quantity = quantity;
		a.HasCharges = hasCharges;
		a.chargesRemaining = chargesRemaining;
		
		return m.AddObject(a);
	}
	
	public static bool SaveItem(InventoryItem s, string file)
	{
		return m.SaveObject(s, file);
	}
	
	public static void DeleteItem(string name)
	{
		m.DeleteObject(name);
	}
}
